home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!news
- From: jlilley@ix.netcom.com (John Lilley)
- Newsgroups: comp.lang.c++
- Subject: Re: g++ 2.5.8 -> 2.7.0 Syntax Error
- Date: 29 Mar 1996 16:53:51 GMT
- Organization: Netcom
- Message-ID: <4jh4iv$scq@dfw-ixnews6.ix.netcom.com>
- References: <boyseDozKHC.JyA@netcom.com>
- NNTP-Posting-Host: den-co11-03.ix.netcom.com
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- X-NETCOM-Date: Fri Mar 29 10:53:51 AM CST 1996
- X-Newsreader: WinVN 0.99.7
-
- In article <boyseDozKHC.JyA@netcom.com>, boyse@netcom.com says...
- >
- >#include <stdlib.h>
- >enum Elt_Type {None, Tri_3, Tri_6, Quad_4, Tet_4};
- >
- >// Base class for elements
- >class Element
- >{
- >public:
- >
- > int elt_number; // element number
- > Elt_Type elt_type; // element type
- > int n_nodes; // number of nodes
- > int prop_id; // property ID
- > int surf_id; // surface property ID
- > int *nodes; // [n_nodes]
- > float **node_coord; // [n_nodes] [3]
- >
- > Element(void)
- > : elt_number(0), elt_type(None), n_nodes(0),
- > nodes(NULL), node_coord(NULL) {}; // Default constructor
- >};
- >
- >// 6 node triangular element
- >class Tri_6 : public Element
- >{
- >public:
- > Tri_6(void) : Element() {}; // Default Constructor
- >};
- >
- >// Element Utility Routines
- >Element *Next_Element(Element *ptr_elt)
- >{
- > ptr_elt = new Tri_6(); // ******* THIS IS THE OFFENDING LINE ********
- > return ptr_elt;
- >}
-
-
- As a matter of style, dont use func(void) in declarations, use func().
-
- The actual problem should be fixed with:
-
- ptr_elt = new Tri_6; // no () in new using default ctor
-
- john lilley
-
-